package bairui.international.weixin.portal.miniapp.controller.pack.order;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.lianjing.sh.spring.web.controller.base.action.Action;
import com.lianjing.sh.spring.web.controller.enhance.output.FomatOutput;

import bairui.international.service.Service_ProductOrder;

/**
 *
 * 得到订单
 *
 * @generated
 * 
 * @see STest_C_Pack_Order_Get_Get 测试
 *
 */
@Controller
public class C_Pack_Order_Get_Get
 extends SC_Pack_Order_Get_Get 
{
	
	@Autowired private Service_ProductOrder productOrder;
//	@Autowired private Service_ProductOrderPack service_ProductOrderPack;
	
	/**
	 * Get请求
	 */
	@Action(Get.class)
	@GetMapping(Get.RequestMappingValue)
	public @FomatOutput @ResponseBody Object get(
		ModelMap map, HttpServletRequest request, 
		@PathVariable(name=Get.PathVariableName.Id) long id,
		@RequestParam String skey
	) throws Exception {
//		TB_ProductOrder bean = productOrder.findOne(it->
//			it.user.skey.eq(skey)
//			.and(it.id.eq(id))
//			.and(it.type.eq(Type_ProductOrder.Pack))
//		);
//		return new Output(
//				bean.getId(), 
//				bean.getNumber(), 
//				bean.getState(),
//				bean.getState().getComment(),
//				bean.getPrice(), 
//				bean.getAmount(), 
//				service_ProductOrderPack
//					.list(it2->it2.productOrder.eq(bean))
//					.stream()
//					.map(it2->new ItemOutput(
//							it2.getId().toString(),
//							it2.getProductName(), 
//							it2.getProductNumber(), 
//							it2.getProductPrice(),
//							it2.getAmount(),
//							new C_Pack_Order_ShowImg_Get.Get.Operate() {
//								@Override public Object getId() {
//									return it2.getId();
//								}
//							}.getUrl()
//						))
//					.collect(Collectors.toList()),
//				new AddressOutput(bean.getGoodsInfo())
//			);
		return null;
	}
	
//	@AllArgsConstructor
//	public static class Output {
//		@Getter private long id;
//		@Getter private String number;
//		@Getter private State_ProductOrder state;
//		@Getter private String stateComment;
//		@Getter private Double totalPrice;
//		@Getter private Long amount;
//		@Getter private List<ItemOutput> items;
//		@Getter private AddressOutput address;
//		
//	}
//
//	@AllArgsConstructor
//	public static class ItemOutput {
//		@Getter private String id;
//		@Getter private String name;
//		@Getter private String number;
//		@Getter private Double price;
//		@Getter private Long amount;
//		@Getter private String imgUrl;
//	}
//	
//	public static class AddressOutput {
//		AddressOutput(TB_GoodsInfo info){
//			if(null == info){
//				return;
//			}
//			this.id = info.getId();
//			this.username = info.getName();
//			this.phone = info.getPhone();
//			this.address = info.getFixAddress() + " " + info.getAddress();
//		};
//		@Getter private Long id;
//		@Getter private String username;
//		@Getter private String phone;
//		@Getter private String address;
//	}

}
